package com.lys.po;

// default package


import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.Columns;
import org.hibernate.annotations.Type;

/**
 * Account entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "ACCOUNTS", schema = "TEST")
public class Account implements java.io.Serializable {

	// Fields

	/**
	 * serialVersionUID .
	 */
	private static final long serialVersionUID = 6987124376576426489L;
	private Long gid;
	private String userid;
	private String email;
	private FullName fullname;
	private String status;
	private String addr1;
	private String addr2;
	private String city;
	private String state;
	private String zip;
	private String country;
	private String phone;
	private Date birthday;
	private String hobbies;
	private Boolean isvip;

	// Constructors

	/** default constructor */
	public Account() {
	}

	/** minimal constructor */
	public Account(String userid, String email, String firstname, String lastname, String addr1, String city,
			String state, String zip, String country, String phone) {
		this.userid = userid;
		this.email = email;
		this.fullname = new FullName(firstname, lastname);
		this.addr1 = addr1;
		this.city = city;
		this.state = state;
		this.zip = zip;
		this.country = country;
		this.phone = phone;
	}

	// Property accessors
	//@SequenceGenerator(name = "seqGid", sequenceName = "SEQ_ACCOUNT_GID", initialValue = 1, allocationSize = 1)
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "GID", unique = true, nullable = false, precision = 10, scale = 0)
	public Long getGid() {
		return this.gid;
	}

	public void setGid(Long gid) {
		this.gid = gid;
	}

	@Column(name = "USERID", unique = true, nullable = false, length = 80)
	public String getUserid() {
		return this.userid;
	}

	public void setUserid(String userid) {
		this.userid = userid;
	}

	@Column(name = "EMAIL", nullable = false, length = 80)
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "STATUS", length = 2)
	public String getStatus() {
		return this.status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Column(name = "ADDR1", nullable = false, length = 80)
	public String getAddr1() {
		return this.addr1;
	}

	public void setAddr1(String addr1) {
		this.addr1 = addr1;
	}

	@Column(name = "ADDR2", length = 40)
	public String getAddr2() {
		return this.addr2;
	}

	public void setAddr2(String addr2) {
		this.addr2 = addr2;
	}

	@Column(name = "CITY", nullable = true, length = 80)
	public String getCity() {
		return this.city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	@Column(name = "STATE", nullable = true, length = 80)
	public String getState() {
		return this.state;
	}

	public void setState(String state) {
		this.state = state;
	}

	@Column(name = "ZIP", nullable = true, length = 20)
	public String getZip() {
		return this.zip;
	}

	public void setZip(String zip) {
		this.zip = zip;
	}

	@Column(name = "COUNTRY", nullable = true, length = 20)
	public String getCountry() {
		return this.country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	@Column(name = "PHONE", nullable = false, length = 80)
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "BIRTHDAY", length = 7)
	public Date getBirthday() {
		return this.birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	@Column(name = "HOBBIES", length = 200)
	public String getHobbies() {
		return this.hobbies;
	}

	public void setHobbies(String hobbies) {
		this.hobbies = hobbies;
	}

	@Column(name = "ISVIP", precision = 1, scale = 0)
	public Boolean getIsvip() {
		return this.isvip;
	}

	public void setIsvip(Boolean isvip) {
		this.isvip = isvip;
	}

	/**
	 * @return the fullname
	 */
	@Type(type = "com.lys.po.FullNameUserType")
	@Columns(columns = { @Column(name = "FIRSTNAME"), @Column(name = "LASTNAME") })
	public FullName getFullname() {
		return fullname;
	}

	/**
	 * @return the fullname String
	 */
	@Transient
	public String getFullnameStr() {
		return fullname == null ? "" : fullname.toString();
	}

	/**
	 * @param fullname
	 *            the fullname to set
	 */
	public void setFullname(FullName fullname) {
		this.fullname = fullname;
	}

}